package com.example.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class Equipment implements Serializable{

   int  equipmentId;
   int equipmentState;
   String equipmentName;
   String equipmentCharges;
   Date startTime;
   Date endTime;

   //获取器材租用状态
   public String getEquipmentStatus() {
      Date curTime = new Date();
      if(curTime.before(startTime)) {
         return "未被租用";
      } else if (curTime.before(endTime) && curTime.after(startTime)) {
         return "已被租用";
      } else if(curTime.after(endTime)) {
         return "未被租住";
      }

      return "???";
   }
}
